package com.peaksport.framework.common.controller;

import javax.ws.rs.core.MediaType;

import org.apache.servicecomb.provider.rest.common.RestSchema;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 全服务通用Controller
 * 
 *
 * @author jinbin_guo
 *
 */
@RestSchema(schemaId ="pkms-framework-common")
@RequestMapping(value="common", produces = MediaType.APPLICATION_JSON)
public class CommonController {
	
	/**
	 *
	 * 优雅停机
	 * @return
	 */
	@GetMapping(value="shutdown")
	public String shutdown() {
		Thread myThread = new Thread() {
			@Override
			public void run() {
				try {
					//防止服务返回前就停机
					sleep(3000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.exit(0);
			}
		};
		myThread.start();
		return "正在优雅停机...";
		
	}
}
